import Vue from "vue";
import Router from "vue-router";
import Login from "@/components/Login.vue";
import BackIndex from "@/components/backend/BackIndex.vue";
import Index from "@/components/backend/common/index.vue";
import SysUser from "@/components/backend/common/SysUser.vue";
import SysMenu from "@/components/backend/common/SysMenu.vue";
import SysRole from "@/components/backend/common/SysRole.vue";
// 2.全局注册路由
Vue.use(Router);

// 3.配置路由规则
const router = new Router({
  routes: [
    {
      path: "/",
      redirect: "/login",
    },
    {
      path: "/login",
      component: Login,
    },
    {
      path: "/backIndex",
      component: BackIndex,
      meta: {
        title: '首页'
      },
      children: [
           {// 默认路由，渲染 /backIndex/index
            path: "", // 空路径表示默认路由
            name: "index",
            component: Index,
            // meta: {
            //   title: '首页'
            // }
          },
        {//用户管理
          path: "/sysUser",
          namem: "sysUser",
          component: SysUser,
          meta: {
            title: '用户管理'
          }
        },
        {//菜单管理
          path: "/sysMenu",
          namem: "sysMenu",
          component: SysMenu,
          meta: {
            title: '菜单管理'
          }
        },
        {//角色管理
          path: "/sysRole",
          namem: "sysRole",
          component: SysRole,
          meta: {
            title: '角色管理'
          }
        },
      ],
    },
  ],
});

// 4.导出路由对象
export default router;
